﻿<ResourceDictionary
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:local="clr-namespace:Dsl.Ped.Controls.ActionBorder">
    
    <Style TargetType="{x:Type local:ActionBorderControl}">
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type local:ActionBorderControl}">
                    <ControlTemplate.Triggers>
                        <Trigger Property="local:ActionBorderControl.IsSelected" Value="True">
                            <Setter Property="Border.BorderBrush" Value="Black" TargetName="PART_Border"/>
                            <Setter Property="Border.BorderThickness" Value="1" TargetName="PART_Border"/>
                            <Setter Property="Button.Visibility" Value="Visible" TargetName="PART_Button"/>
                        </Trigger>
                        <Trigger Property="local:ActionBorderControl.IsSelected" Value="False">
                            <Setter Property="Border.BorderBrush" Value="Transparent" TargetName="PART_Border"/>
                            <Setter Property="Border.BorderThickness" Value="0" TargetName="PART_Border"/>
                            <Setter Property="Button.Visibility" Value="Hidden" TargetName="PART_Button"/>
                        </Trigger>
                    </ControlTemplate.Triggers>
                    <Border x:Name="PART_Border">
                        <Grid Background="Transparent" x:Name="PART_Grid"> 
                            <ContentPresenter
                                Grid.Row="0"
                                Grid.Column="0"
                                Grid.RowSpan="2"
                                Grid.ColumnSpan="1"
                                Content="{TemplateBinding Content}"/>
                            <Button VerticalAlignment="Top"
                                    HorizontalAlignment="Right"
                                    Command="{TemplateBinding Command}"
                                    CommandParameter="{TemplateBinding CommandParameter}"
                                    x:Name="PART_Button">x</Button>
                        </Grid>
                    </Border>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>
    
</ResourceDictionary>